<?php /*
	
*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['adminuserid']))
{
	header("location:index.php?msg=logfirst");
	die();
}
// UPDATE the record
$p_pimg = "";
$p_bimg = "";
$p_catimg = "";
$p_idea = "";
$p_banner="";
$p_mimg =""; 	
$action=1;
		$sql = "select * from tblimagesettings";
		$result = $obj_db->select($sql);
		if(count($result)<=0) {
			echo " No Record Found!<br>";
			die();
		}
		if($result) {
			foreach($result as $row) {
				$p_pimg = $row['intproductthimage'];
				$p_mimg = $row['intmidiumimg'];	   
		   		$p_bimg = $row['intproductbigimage'];
				$p_catimg = $row['intcategoryimage'];
				$p_idea = $row['intsiteforideasorspecialoffers'];
				$p_banner = $row['intbannerimg'];
				//$action=2;
			}
		}
		if(isset($_REQUEST['Submit']) && trim($_REQUEST['Submit']) == "Update")	{
			$pimg=mysql_real_escape_string($_REQUEST['proimg']);
			$mimg=mysql_real_escape_string($_REQUEST['midimg']);
			$bimg=mysql_real_escape_string($_REQUEST['probimg']);
			$catimg=mysql_real_escape_string($_REQUEST['catimg']);
			$idea=mysql_real_escape_string($_REQUEST['idea']);
			$banner=mysql_real_escape_string($_REQUEST['bannerimg']);
			$sql_upd ="UPDATE tblimagesettings SET  
						intproductthimage = '$pimg',
						intmidiumimg='$mimg',
						intproductbigimage='$bimg',
						intcategoryimage='$catimg',
						intsiteforideasorspecialoffers='$idea',
						intbannerimg='$banner'";
			$result = $obj_db->edit($sql_upd);
			configvalfetch($obj_db);
			header("location:imagesetting.php?msg=setsave");
				die();
			}
?>
<?php include("inc/header.php");?>
<body>
<script language="javascript">
//  only insert integer no in Age field.
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}
function check()
{
if(document.imgset.proimg.value.length==0)
	{
		alert("Please enter product image size.");
		if(condition==true)
		{
			document.imgset.proimg.focus();
		}
		condition=false;
		return false;
	}
if(document.imgset.probimg.value.length==0)
	{
		alert("Please enter size of big image of product.");
		if(condition==true)
		{
			document.imgset.probimg.focus();
		}
		condition=false;
		return false;
	}
if(document.imgset.catimg.value.length==0)
	{
		alert("Please enter category image size");
		if(condition==true)
		{
			document.imgset.catimg.focus();
		}
		condition=false;
		return false;
	}
if(document.imgset.idea.value.length==0)
	{
		alert("Please enter Ideas to Display.");
		if(condition==true)
		{
			document.imgset.idea.focus();
		}
		condition=false;
		return false;
	}		
	if(document.imgset.bannerimg.value.length==0)
	{
		alert("Please enter Banner Image Size.");
		if(condition==true)
		{
			document.imgset.bannerimg.focus();
		}
		condition=false;
		return false;
	}		
}	
</script>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="middlebackground">
  <tr>
    <td colspan="3" valign="top" align="center"><?php include(INC."top.inc.php");?></td>
  </tr>
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="97%"><form action="" method="post" enctype="multipart/form-data" name="imgset">

      <table width="65%" border="0" align="center" cellpadding="2" cellspacing="2" class="border">
        <tr class="bg1">
          <td colspan="5" align="center"><strong>Image Setting...</strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td>&nbsp;</td>
          <td align="right">(* All fields are Required)</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="2%">&nbsp;</td>
          <td width="38%" align="right" class="sltimg">*Product Image width</td>
          <td width="3%">:</td>
          <td width="51%" align="left"><input name="proimg" type="text" id="proimg" value="<?php echo stripslashes($p_pimg);?>" />px</td>
          <td width="6%">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="right" class="sltimg">Product Medium Image width</td>
          <td>:</td>
          <td align="left"><input name="midimg" type="text" id="midimg" value="<?php echo stripslashes($p_mimg);?>" />px</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="right" class="sltimg">*Product Big Image width</td>
          <td>:</td>
          <td align="left"><input name="probimg" type="text" id="probimg" value="<?php echo stripslashes($p_bimg);?>" />px</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td align="right" class="sltimg">*Category Image width</td>
          <td>:</td>
          <td align="left"><input name="catimg" type="text" id="catimg" value="<?php echo stripslashes($p_catimg);?>" />px</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*Ideas &amp; Special Offers width</td>
          <td align="left">:</td>
          <td align="left"><input name="idea" type="text" id="idea" value="<?php echo stripslashes($p_idea);?>" />px</td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="right" class="sltimg">*Banner Image Size width</td>
          <td align="left">:</td>
          <td align="left"><input name="bannerimg" type="text" id="bannerimg" value="<?php echo stripslashes($p_banner);?>" />px</td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" align="left">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="5" align="center"><input name="Submit" type="submit" class="btn" id="Submit" value="Update"  onclick="return check();"/></td>
        </tr>
        <tr>
          <td colspan="5" align="center">&nbsp;</td>
        </tr>
      </table>
            </form>
    </td>
    <td width="2%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" align="center"><?php include(INC."bottom.php");?></td>
  </tr>
</table>

</body>
</html>
